package middleware;

import java.net.MalformedURLException;
import java.net.URL;

import middleware.p2p.global.logger.GlobalLogger;
import middleware.p2p.global.logger.GlobalLoggerService;
import middleware.p2p.log.MiddlewareLogEvent;
import middleware.p2p.log.VectorClock;


public class WSTester {
	static GlobalLoggerService logger;
	public static void main(String args[]) {
		try {
			logger=new GlobalLoggerService(new URL("http://localhost:8080/GlobalLoggerService/GlobalLogger?wsdl"));
		} catch (MalformedURLException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		System.out.println("=>Getting PortType");
		GlobalLogger portType=logger.getGlobalLoggerPort();
		System.out.println("=>Invoking method");
		String comp1e="1e6079bf8eb90d4c4eba2fae710b5386";
		String comp53="53471bb47aa35da4abb102b3f54c2221";
		MiddlewareLogEvent event= new MiddlewareLogEvent();
		VectorClock vc=new VectorClock();
		vc.setClock(comp1e, 1);
		vc.setClock(comp53,0);		
		event.setComponentID(comp1e);
		event.setVclock(vc);
		event.setTimestamp(1295822179836L);
		event.setDescription("Manager started.");
		portType.push(event);
		vc.setClock(comp1e, 0);
		vc.setClock(comp53,2);		
		event.setComponentID(comp53);
		event.setVclock(vc);
		event.setTimestamp(1295822179827L);
		event.setDescription("Manager started.");
		portType.push(event);
		vc.setClock(comp1e, 2);
		vc.setClock(comp53,0);		
		event.setComponentID(comp1e);
		event.setVclock(vc);
		event.setTimestamp(1295822179837L);
		event.setDescription("Worker started on 127.0.0.1:19191");
		portType.push(event);
		vc.setClock(comp1e, 0);
		vc.setClock(comp53,1);		
		event.setComponentID(comp53);
		event.setVclock(vc);
		event.setTimestamp(1295822179827L);
		event.setDescription("Worker started on 127.0.0.1:18181");
		portType.push(event);
		vc.setClock(comp1e, 3);
		vc.setClock(comp53,0);		
		event.setComponentID(comp1e);
		event.setVclock(vc);
		event.setTimestamp(1295822194962L);
		event.setDescription("Workflow 1700847468 inserito nella coda.");
		portType.push(event);
		vc.setClock(comp1e, 4);
		vc.setClock(comp53,0);		
		event.setComponentID(comp1e);
		event.setVclock(vc);
		event.setTimestamp(1295822194969L);
		event.setDescription("Workflow 1700847468 extracted from the queue.");
		portType.push(event);
		vc.setClock(comp1e, 5);
		vc.setClock(comp53,0);		
		event.setComponentID(comp1e);
		event.setVclock(vc);
		event.setTimestamp(1295822195338L);
		event.setDescription("TaskDescriptor 1664065248 sent to 127.0.0.1:18181");
		portType.push(event);
		vc.setClock(comp1e, 5);
		vc.setClock(comp53,3);		
		event.setComponentID(comp53);
		event.setVclock(vc);
		event.setTimestamp(1295822195364L);
		event.setDescription("Enqueued TaskDescriptor with ID 1664065248 received from 127.0.0.1:59049");
		portType.push(event);
		vc.setClock(comp1e, 5);
		vc.setClock(comp53,4);		
		event.setComponentID(comp53);
		event.setVclock(vc);
		event.setTimestamp(1295822195371L);
		event.setDescription("Task 1664065248 extracted");
		portType.push(event);
		vc.setClock(comp1e, 6);
		vc.setClock(comp53,0);		
		event.setComponentID(comp1e);
		event.setVclock(vc);
		event.setTimestamp(1295822195541L);
		event.setDescription("File /home/losciamano/restart_tomcat.sh sent to 127.0.0.1:18181");
		portType.push(event);
		vc.setClock(comp1e, 5);
		vc.setClock(comp53,5);		
		event.setComponentID(comp53);
		event.setVclock(vc);
		event.setTimestamp(1295822195562L);
		event.setDescription("Dummy execution of task 1664065248 : sh /home/losciamano/restart_tomcat.sh");
		portType.push(event);
		vc.setClock(comp1e, 5);
		vc.setClock(comp53,6);		
		event.setComponentID(comp53);
		event.setVclock(vc);
		event.setTimestamp(1295822195607L);
		event.setDescription("File restart_tomcat.sh loaded from Socket connected to 127.0.0.1:59049");
		portType.push(event);
	}
}
